<?php
//获取要下载的文件名
$filename = $_GET['pic'];
$filename=$imgDir = dirname(__FILE__)."/../".$filename;
//设置头信息
header('Content-Disposition:attachment;filename=' . basename($filename));
header('Content-Length:' . filesize($filename));
//读取文件并写入到输出缓冲
readfile($filename);
?>